/*
 * @lc app=leetcode.cn id=263 lang=cpp
 *
 * [263] 丑数
 */
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>

using namespace std;
// @lc code=start
class Solution {
public:
    bool isUgly(int n) {
        if(n == 0) {
            return false;
        }
        if(n == 1) {
            return true;
        }
        vector<int> v;
        
        while(n%2 == 0 || n%3 == 0 || n%5 ==0) {
            if(n%2 == 0) {
                n /= 2;
            }
            if(n%3 == 0) {
                n /= 3;
            }
            if(n%5 == 0) {
                n /= 5;
            }
        }
        if(n == 1) {
            return true;
        }else {
            return false;
        }
    }
};
// @lc code=end

